﻿
using System;
using System.Web;
using System.Collections.Generic;
using BLToolkit.Mapping;
using BLToolkit.Data;
using BLToolkit.Reflection;

/// <summary>RouteStationM2M_id</summary>
public class RouteStationM2M : LoggingObject
{
	public RouteStationM2M()
	{
		route = new Route();
		station = new Station();
	}
	[Nullable]
	[MapField("RouteStationM2M_id")]
	public Int64 Id { get; set; }

	/// <summary>id маршрута</summary>
	[Nullable]
	public Int64 Route_id { get { return route.Id; } }
	/// <summary>Маршрут</summary>
	[Nullable]
	public Route route { get; set; }

	/// <summary>id остановки</summary>
	[Nullable]
	public Int64 Station_id { get { return station.Id; } }
	/// <summary>Остановка</summary>	
	[Nullable]
	public Station station { get; set; }

	/// <summary>Расстояние от станции отправления до текущей остановки</summary>
	[Nullable]
	[MapField("RouteStationM2M_Distance")]
	public double Distance { get; set; }

	/// <summary>Время в пути от станции отправления до текущей остановки</summary>
	[Nullable]
	[MapField("RouteStationM2M_TimeDistance")]
	public double TimeDistance { get; set; }

	/// <summary>Место остановки</summary>
	[Nullable]
	[MapField("RouteStationM2M_LandingPlace")]
	public string LandingPlace { get; set; }

	/// <summary>Флаг - удалить или добавить</summary>
	public bool x { get; set; }

	public bool Merge()
	{
		try
		{
			SetLoggingInfo();
			this.Id = DBEntity<RouteStationM2M>.Merge(this);
			return true;
		}
		catch { return false; }
	}
}
